Skip to content

LDAP: allow multiple roles to be fetched from group role attribute #17021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

fer-marino
Copy link

For some weird reasons, only the first element of the list returned by the LDAP query is used to create authorities. This PR fixes it creating an authority for all the returned roles.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 30, 2025
@jzheaux
Copy link
Contributor

jzheaux commented May 1, 2025

@fer-marino, thanks for contributing. I don't think we should go further down the route of using low-level types, but instead would be better off using DirContextOperations directly. This allows the application to be more expressive without needing to know how to navigate Spring Security's special set of keys like DN_KEY.

I've added #17028 to track this work. In the meantime, have you tried using NestedLdapAuthoritiesPopulator with a max search depth of 1? I believe that implementation adds all the roles by default.

@jzheaux jzheaux added in: ldap An issue in spring-security-ldap type: enhancement A general enhancement status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels May 1, 2025
@jzheaux jzheaux self-assigned this May 1, 2025
@fer-marino
Copy link
Author

thank you for your feedback. I'll close this and open a new one with your recommendations

@fer-marino fer-marino closed this May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: ldap An issue in spring-security-ldap status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants